home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / include / netccitt / x25.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  6.1 KB  |  158 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Copyright (c) University of British Columbia, 1984
  3.  * Copyright (c) 1990, 1992, 1993
  4.  *    The Regents of the University of California.  All rights reserved.
  5.  *          University of Erlangen-Nuremberg, Germany, 1992
  6.  * 
  7.  * This code is derived from software contributed to Berkeley by the
  8.  * Laboratory for Computation Vision and the Computer Science Department
  9.  * of the the University of British Columbia and the Computer Science
  10.  * Department (IV) of the University of Erlangen-Nuremberg, Germany.
  11.  *
  12.  * Redistribution and use in source and binary forms, with or without
  13.  * modification, are permitted provided that the following conditions
  14.  * are met:
  15.  * 1. Redistributions of source code must retain the above copyright
  16.  *    notice, this list of conditions and the following disclaimer.
  17.  * 2. Redistributions in binary form must reproduce the above copyright
  18.  *    notice, this list of conditions and the following disclaimer in the
  19.  *    documentation and/or other materials provided with the distribution.
  20.  * 3. All advertising materials mentioning features or use of this software
  21.  *    must display the following acknowledgement:
  22.  *    This product includes software developed by the University of
  23.  *    California, Berkeley and its contributors.
  24.  * 4. Neither the name of the University nor the names of its contributors
  25.  *    may be used to endorse or promote products derived from this software
  26.  *    without specific prior written permission.
  27.  *
  28.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  29.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  32.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  37.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38.  * SUCH DAMAGE.
  39.  *
  40.  *    @(#)x25.h    8.1 (Berkeley) 6/10/93
  41.  */
  42.  
  43. #ifdef KERNEL
  44. #define PRC_IFUP    3
  45. #define PRC_LINKUP    4
  46. #define PRC_LINKDOWN    5
  47. #define PRC_LINKRESET    6
  48. #define PRC_LINKDONTCOPY    7
  49. #ifndef PRC_DISCONNECT_REQUEST  
  50. #define PRC_DISCONNECT_REQUEST 10
  51. #endif
  52. #endif
  53.  
  54. #define CCITTPROTO_HDLC        1
  55. #define CCITTPROTO_X25        2    /* packet level protocol */
  56. #define IEEEPROTO_802LLC    3    /* doesn't belong here */
  57.  
  58. #define HDLCPROTO_LAP        1
  59. #define HDLCPROTO_LAPB        2
  60. #define HDLCPROTO_UNSET        3
  61. #define HDLCPROTO_LAPD        4
  62.  
  63. /* socket options */
  64. #define PK_ACCTFILE        1    /* use level = CCITTPROTO_X25 */
  65. #define PK_FACILITIES        2    /* use level = CCITTPROTO_X25 */
  66. #define PK_RTATTACH        3    /* use level = CCITTPROTO_X25 */
  67. #define PK_PRLISTEN        4    /* use level = CCITTPROTO_X25 */
  68.  
  69. #define MAX_FACILITIES        109     /* maximum size for facilities */
  70.  
  71. /*
  72.  *  X.25 Socket address structure.  It contains the  X.121 or variation of
  73.  *  X.121, facilities information, higher level protocol value (first four
  74.  *  bytes of the User Data field), and the last  12 characters of the User
  75.  *  Data field.
  76.  */
  77.  
  78. struct x25_sockaddr {        /* obsolete - use sockaddr_x25 */
  79.     short  xaddr_len;        /* Length of xaddr_addr.        */
  80.     u_char xaddr_addr[15];    /* Network dependent or X.121 address.    */
  81.     u_char xaddr_facilities;    /* Facilities information.        */
  82. #define XS_REVERSE_CHARGE    0x01
  83. #define XS_HIPRIO        0x02
  84.     u_char xaddr_proto[4];    /* Protocol ID (4 bytes of user data).    */
  85.     u_char xaddr_userdata[12];    /* Remaining User data field.        */
  86. };
  87.  
  88. /*
  89.  *  X.25 Socket address structure.  It contains the network id, X.121
  90.  *  address, facilities information, higher level protocol value (first four
  91.  *  bytes of the User Data field), and up to 12 characters of User Data.
  92.  */
  93.  
  94. struct    sockaddr_x25 {
  95.     u_char    x25_len;
  96.     u_char    x25_family;    /* must be AF_CCITT */
  97.     short    x25_net;    /* network id code (usually a dnic) */
  98.     char    x25_addr[16];    /* X.121 address (null terminated) */
  99.     struct    x25opts {
  100.         char    op_flags;    /* miscellaneous options */
  101.                     /* pk_var.h defines other lcd_flags */
  102. #define X25_REVERSE_CHARGE    0x01    /* remote DTE pays for call */
  103. #define X25_DBIT        0x02    /* not yet supported */
  104. #define X25_MQBIT        0x04    /* prepend M&Q bit status byte to packet data */
  105. #define X25_OLDSOCKADDR        0x08    /* uses old sockaddr structure */
  106. #define X25_DG_CIRCUIT        0x10    /* lcd_flag: used for datagrams */
  107. #define X25_DG_ROUTING        0x20    /* lcd_flag: peer addr not yet known */
  108. #define X25_MBS_HOLD        0x40    /* lcd_flag: collect m-bit sequences */
  109.         char    op_psize;    /* requested packet size */
  110. #define X25_PS128        7
  111. #define X25_PS256        8
  112. #define X25_PS512        9
  113.         char    op_wsize;    /* window size (1 .. 7) */
  114.         char    op_speed;    /* throughput class */
  115.     } x25_opts;
  116.     short    x25_udlen;    /* user data field length */
  117.     char    x25_udata[16];    /* user data field */
  118. };
  119.  
  120. /*
  121.  * network configuration info
  122.  * this structure must be 16 bytes long
  123.  */
  124.  
  125. struct    x25config {
  126.     struct    sockaddr_x25 xc_addr;
  127.     /* link level parameters */
  128.     u_short    xc_lproto:4,    /* link level protocol eg. CCITTPROTO_HDLC */
  129.         xc_lptype:4,    /* protocol type eg. HDLCPROTO_LAPB */
  130.         xc_ltrace:1,    /* link level tracing flag */
  131.         xc_lwsize:7;    /* link level window size */
  132.     u_short    xc_lxidxchg:1,  /* link level XID exchange flag - NOT YET */
  133.     /* packet level parameters */
  134.             xc_rsvd1:2,
  135.                 xc_pwsize:3,    /* default window size */
  136.         xc_psize:4,    /* default packet size 7=128, 8=256, ... */
  137.         xc_type:3,    /* network type */
  138. #define X25_1976    0
  139. #define X25_1980    1
  140. #define X25_1984    2
  141. #define X25_DDN        3
  142. #define X25_BASIC    4
  143.         xc_ptrace:1,    /* packet level tracing flag */
  144.         xc_nodnic:1,    /* remove our dnic when calling on net */
  145.         xc_prepnd0:1;    /* prepend 0 when making offnet calls */
  146.     u_short    xc_maxlcn;    /* max logical channels */
  147.     u_short    xc_dg_idletimo;    /* timeout for idle datagram circuits. */
  148. };
  149.  
  150. #ifdef IFNAMSIZ
  151. struct ifreq_x25 {
  152.     char    ifr_name[IFNAMSIZ];        /* if name, e.g. "en0" */
  153.     struct    x25config ifr_xc;
  154. };
  155. #define    SIOCSIFCONF_X25    _IOW('i', 12, struct ifreq_x25)    /* set ifnet config */
  156. #define    SIOCGIFCONF_X25    _IOWR('i',13, struct ifreq_x25)    /* get ifnet config */
  157. #endif
  158.